package proxy

import "fmt"

type tLoggableOrderService struct {
	mOrderService IOrderService
}

func NewLoggableOrderService(service IOrderService) IOrderService {
	return &tLoggableOrderService{
		mOrderService: service,
	}
}

func (me *tLoggableOrderService) Load(id int) (error, *Order) {
	return me.mOrderService.Load(id)
}

func (me *tLoggableOrderService) Save(it *Order, user IUser) error {
	e := me.mOrderService.Save(it, user)
	fmt.Printf("IOrderService.Save, user=%v, order=%v, error=%v\n", user.Name(), it, e)
	return e
}

func (me *tLoggableOrderService) Delete(id int, user IUser) error {
	e := me.mOrderService.Delete(id, user)
	fmt.Printf("IOrderService.Delete, user=%v, order.id=%v, error=%v\n", user.Name(), id, e)
	return e
}